#ifndef ROOM_H_
#define ROOM_H_

#include "connections.h" 


#define MAX_USERS 5

struct user_t {
	char *nick;
	int fd;	
};


/* Adds the new user "nickname" to the room. It also
 * sends the corresponding messages notifying clients
 * of the event. If the login message is unexpected 
 * qiven the connection's status, the function renders
 * side effect.
 * Returns:
 *			0 - Successful.
 * 			1 - Error: the nickname is already taken.
 * 			2 - Error: the room is full.
*/
int login_user(const char *nickname, int sock_fd);

/* Removes the user "nickname" from the room.
 * Returns:
 *			0 - Successful.
 *          1 - Unsuccessful. 
*/
int logout_user(const char *nickname);

/*
*/
int logout_user_by_fd(int sock_fd);

/*
*/
int user_lookup(const char *nick);

/*
*/
char *user_socktonick(int fd);

/*
*/
int user_nicktosock(const char *nick);

/*
*/
int room_size_bytes();

/*
*/
void list_users(char* buffer);

/*
*/
void debug_room();

        
#endif
